package com.felix.spider.web;

import com.felix.spider.service.TrainTimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author felix.ma
 * @create 2018-07-02 14:15
 **/
@RestController
public class TrainController {

    @Autowired
    private TrainTimeService trainTimeService;

    @RequestMapping("/test1")
    public String test1(String startDate) {

        return trainTimeService.htmlUnitGet(startDate);
    }

    @RequestMapping("/startTrainTime/{startDate}")
    public String startTrainTime(@PathVariable("startDate") String startDate) {
        return trainTimeService.htmlUnitGet(startDate);
    }

    @RequestMapping("/stopTrainTime")
    public void stopTrainTime() {
        trainTimeService.threadsStop();
    }

    @RequestMapping("/test2")
    public String test2() {
        return "1111";
    }
}
